<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/conn.asp"-->
<!--#include file="lib/saferequest.asp"-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<!-- jquery和ui -->
<script type="text/javascript" src="lib/jquery_lastest.js"></script>
<script type="text/javascript" src="lib/jquery_timers_lastest.js"></script>

<script type="text/javascript">
$(function() {
	//https://www.google.com/latitude/apps/badge/api?user=5661037576488719294&type=json
	//	var user="5661037576488719294";
	//	$.getJSON("jsonproxy.asp",{"url":"https://www.google.com/latitude/apps/badge/api?user="+user+"&type=json"},function(data){
	//		lng=data.features[0].geometry.coordinates[0];
	//		lat=data.features[0].geometry.coordinates[1];
	//		id=data.features[0].properties.id;
	//		timeStamp=data.features[0].properties.timeStamp;
	//		accuracyInMeters=data.features[0].properties.accuracyInMeters;
	//		reverseGeocode=data.features[0].properties.reverseGeocode;
			//alert(lat);
			//alert(lng);
			//alert(id);
			//alert(timeStamp);
			//alert(accuracyInMeters);
			//alert(reverseGeocode);
			//var t = new Date(timeStamp);
			//alert(t.toLocaleString());

	//		$("#res").html(reverseGeocode);
	//	});
function closeWindow() {  
    window.opener = null;  
    window.open('', '_self', '');  
    window.close();  
} 	
ip="61.153.145.162:8888";
//http://61.153.145.162:8888/getpositionTP.asp?regnum=浙B8E792 
//电信地址
//http://221.12.55.171:8889/getpositionTP.asp?regnum=浙B8E792 
//网通地址

line="telcom";
var cph;
var lng,lat;
var timestamp;
var speed;
var mlURL;
var reverse;
	
	$("body").everyTime('5s','A',function(){
	
		$.getJSON("http://"+ip+"/getpositionTP.asp?regnum=all&line="+line+"&jsonpcallback=?",function(data){
			if(!jQuery.isEmptyObject(data)){
				$.each(data,function(i,item){
					//alert(i);
					cph=data[i].LicensePlate;
					lng=data[i].Geometry.Coordinates[0];
					lat=data[i].Geometry.Coordinates[1];
					timestamp=data[i].TimeStamp;
					speed=data[i].Speed;
					mlURL=data[i].mlURL;
					$.ajax({
						type: "GET",
						async: false,
						url: "jsonproxy.asp",
						data: {"url":"http://maps.google.com/maps/api/geocode/json?latlng="+lat+","+lng+"&sensor=false&region=cn&language=zh-CN"},
						success:function(addr){
								reverse=addr.results[0].formatted_address;
								reverse=reverse .replace(/中国浙江省/,"");
								$.post("update_mlgps.asp",{"cph":cph,"lat":lat,"lng":lng,"timestamp":timestamp,"speed":speed,"reverse":reverse});
						}
					});
					
				});
			}
		});

		$("body").everyTime('5s','B',function(){
			closeWindow();
		},1,true);

	},1,true);
});
</script>

</head>
<body>
<div id="delay"></div>
<div id="info"></div>
<%
set rs = Server.CreateObject("ADODB.Recordset")
sql="SELECT cl_usergeo FROM cl where cl_usergeo<>'' and cl_usergeo is not null"
rs.open sql,conn,1,1
'response.write(sql)
do while not rs.eof
%>
<div>
	<span class="cl_usergeo"><%=rs("cl_usergeo")%></span><span></span>
</div>
<%	
	rs.movenext
loop
	
rs.close
conn.close
set conn=nothing

%>


</body>
</html>
